﻿using Furion.DynamicApiController;
using HOPU.OnlineSchool.Application.Teachers.Dtos;
using HOPU.OnlineSchool.Application.Teachers.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HOPU.OnlineSchool.Application.Teachers
{
    /// <summary>
    /// 讲师管理接口
    /// </summary>
  public  class TeacherAppService: IDynamicApiController
    {
        private readonly ITeacherService _teacherService;

        public TeacherAppService(ITeacherService teacherService)
        {
            _teacherService = teacherService;
        }
        /// <summary>
        /// 分页查询讲师信息
        /// </summary>
        /// <param name="page"></param>
        /// <param name="limit"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PagedList<TeacherListOutput>> List(int page, int limit, TeacherListInput input) 
        {
            var list=await _teacherService.GetPagedListAsync(page, limit, input);
            return list;
        }
        /// <summary>
        /// 删除讲师信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task Delete(string id) {
         await _teacherService.DelectAsync(id);
        }
        /// <summary>
        /// 添加讲师信息
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task Add(TeacherAddInput input) {
           await _teacherService.AddAsync(input);
        }
        /// <summary>
        /// 根据id查询讲师信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task<TeacherDto> Get(string id)
        {
           return await _teacherService.GetTeacherAsync(id);
        }
        /// <summary>
        /// 修改讲师信息
        /// </summary>
        /// <param name="id"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task Update(string id,TeacherDto input) {
           await _teacherService.UpdateAsync(id,input);
        }

    }
}
